package com.hx.bio;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
import java.util.UUID;

/**
 * @author Huathy
 * @date 2021-10-19 23:00
 * @description
 */
public class BioClient {
    public static void main(String[] args) throws IOException {
        //要和谁通信？服务器IP，端口
        //一台机器的端口是有限的
        Socket socket = new Socket("localhost",8888);
        //输出write
        OutputStream os =  socket.getOutputStream();
        String name = UUID.randomUUID().toString();
        System.out.println("客户端发送数据："+ name);
        os.write(name.getBytes(StandardCharsets.UTF_8));
        os.flush();
        os.close();
        socket.close();
    }
}
